perm filename SERIAL.DOC[KBD,ROB]3 blob sn#455038 filedate 1979-06-25 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00009 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	Writeup on the Micro Switch Keyboard Serialzers
C00003 00003	Functional description
C00006 00004	Physical characteristics
C00008 00005	Electrical characteristics
C00009 00006	Some notes on EIA and current loop protocols
C00012 00007	Programming considerations
C00016 00008	Signal definitions
C00021 00009	prototype notes:
C00025 ENDMK
C⊗;
Writeup on the Micro Switch Keyboard Serialzers

	**** WARNING ****

As of 27-May-79, the prototype is still being built, and the information
contained herein does not neccessarily reflect the way the Keyboard
Serializers will end up.

last update:
25-Jun-79	Spacewar poll character must be a specific character
Functional description

The Keyboard Serialzers take the 10 bits of parallel data from the Stanford
Micro Switch keyboards (11 bits if you count the keyboard strobe), and
transmits this data as two 8-bit bytes on a serial line.  Whenever a key
is pressed that generates "KBDSTROBE", a sequence starts which transmits
first a byte containing the "Bucky bits" (Control, Meta, Shift, and Top
keys), followed by a byte that has the actual key data.  This data goes
out over a two-wire, electrically floating, passive current loop.

There are times when the host computer wants to know what keys are being
pressed at that moment.  To accomplish this, the serializer is built to
receive data as well as transmit it.  When the serializer receives the
magic charatacter "***", the seriailzer will transmit a pair of bytes,
exactly as if a key were newly pressed.  (This mode of operation is called
"Spacewar Mode" for reasons that date back to the game of the same name.)
Note that if more than one key is pressed, the logical OR of the bits are
read in, just as in the (old) keyboard scanner.

Physical characteristics

The Keyboard Serializers are built on a printed circuit board and mounted
inside of the Micro Switch keyboards.  They ride "piggyback" on the
existing circuit boards, and connect to them via a short edge-card
connector jumper cable.  The serializer provides power to the Micro Switch
keyboard circtuitry through this jumper.

Another edge connector on the serializer board connects to the I/O cable.
This cable provides power (5 volts) and ground, and two pairs of current
loop signal (on transmit and one receive).

Electrical characteristics

Some notes on EIA and current loop protocols

The two states of an EIA or current loop line are called MARK and SPACE.
An idle keyboard will send continuous MARKS.
An unplugged keyboard (or a keyboard with the BREAK (sic) key pressed) will
send continuous SPACEs.  Continuous SPACEs will cause "framing errors" in
the receiving UART.

In EIA land, a MARK is signified by a low voltage.  (On the DCA, this is
about -12 volts).  A space is signified by a higher voltage (on the DCA,
approching 0? volts).

In current loop land, a MARK is signified by a conducting wire, (as if there
were a closed switch at the far end of the loop).  A SPACE is signified by an
open circuit (no current flow).

The first bit of a transmitted byte is the START BIT, which is always a SPACE
(EIA → low voltage, CurLoop → not conducting).  The next eight bits are data
bits, where a 1 bit is a MARK and a 0 bit is a SPACE.  The last transmitted
is a STOP BIT, which is always a MARK bit.  (Note that the line stays in the
MARK condition until the next byte gets transmitted).

When we say that this is the format of the transmitted data,

(first byte)---------------------------¬(second byte)---------------------------
|  00   01   02   03   04   05   06   07|  10   11   12   13   14   15   16   17|
|  ON  OFF  OFF SWRQ KBST META CTRL  TOP| OFF SHFT  KB5  KB4  KB3  KB2  KB1  KB0|
|_______________________________________|_______________________________________|

We really transmit:

.....idle.........|strt|data...................................|stop|
 mrk  mrk .... mrk  spc  mrk  spc  spc swrq kbst meta ctrl  top  mrk 

		  |strt|data...................................|stop|idle.......
		    spc  spc shft  kb5  kb4  kb3  kb2  kb1  kb0  mrk  mrk  mrk...

Programming considerations

The serializer sends out two bytes for each keyboard strobe. The order of the
bits are:

(first byte)---------------------------¬(second byte)---------------------------
|  00   01   02   03   04   05   06   07|  10   11   12   13   14   15   16   17|
|  ON  OFF  OFF SWRQ KBST META CTRL  TOP| OFF SHFT  KB5  KB4  KB3  KB2  KB1  KB0|
|_______________________________________|_______________________________________|

name	comments
SWRQ	If this bit is on, it means that this data is being sent in response to
	a spacewar request to read the keyboard.
KBST	If this bit is on, it means that this data is being sent because somebody
	typed a key.
META	The META key from the keyboard.
CTRL	The CONTROL key from the keyboard.
TOP	The TOP key from the keyboard.
SHFT	The SHIFT key from the keyboard.
KB5-KB0	The keyboard data proper. These are not decoded ASCII, remember.
	See the table below for the character codes for each key.

Note that the high order bit of the first byte is always on, and the high order
bit of the second byte is always off.  This should make it possible to get back
in sync if somehow we forget which byte we were on.

It is possible for both SWRQ and KBST to be on in the case where a
spacewar request was issued, and a key was concurrently typed.  However,
if both these bits are off, there is an error of some sort.

    MICROSWITCH KEYBOARD CHARACTER CODES

	 0   1   2   3   4   5   6   7  

     00  --- a   b   c   d   e   f   g  
     10  h   i   j   k   l   m   n   o  
     20  p   q   r   s   t   u   v   w  
     30  x   y   z   CR  \   LF  --- ---
     40  SPC BRK ESC CAL CLR TAB FF  VT 
     50  (   )   *   +   ,   -   .   /  
     60  0   1   2   3   4   5   6   7  
     70  8   9   :   ;   BS  ALT --- ---

Signal definitions

Here is a list of the signals used in the keyboard serializers:

BHI	  Logical HIGH signal used whenever a TTL signal needs to be tied to HIGH.
BSEL	  Low means first byte selected (bucky bits), high means second byte
	  selected (data bits).
CTRL	  "Control" key from keyboard.
DONE	  Come true when the second byte has been loaded in the UART for 
	  tranmission.
GND	  Logical LOW.
KB0-KB5	  Data bits direct from the keyboard.
KBSTROBE  Comes high when any key is pressed, and valid data appears on KBO0-5.
META	  "Meta" key from keyboard.
MRCLOCK	  MasteR CLOCK, runs at 16 times the baud rate.
SERRCV	E5(20)     TIP	-1.60	0.01	RI	UART	TR1602	DATA5	B7
SERXMT	E5(25)     TO	1.60	-0.20	TRO	UART	TR1602	DATA5	B7
SHIFT	  "Shift" key from keyboard.
SPWRQST	E3(14)     TIP	-0.80	0.02	4A	74LS157	LS157	DATA5	B3
SYNC	  When true, we have just loaded a character into the Transmitter
	  Holding Register, and better not switch the Byte Select or anything
	  silly like that.
THRE      Transmitter Holding Register Empty, the UART is ready to have a character
	  loaded into it for transmission.
THRL   	  Transmitter Holding Register Load.
	  When true, data is latched into the Transmitter Holding Register.  On
	  the transition from true to false, the data is strobed into the
	  Register (if no character is currently being transmitted).
TOP	  "Top" key from the keyboard.
VCC	  Illogical HIGH, +5V, used to power the chips and current loop converter.
XMRQ	  Means that there is a request to transmit a character, either due
	  to a keyboard strobe or character received from the host.

prototype notes:

This is where some signals are found

name	PC board loc	BURNDY loc	DEC cable
	(note 1)	(note 2)	(note 3)
+5V			A		AA2
GND			B		AC2
KB0(lsb)		D		AS2
KB1			E		AR2
KB2			F		AP2
KB3			J		AN2
KB4			H		AM2
KB5(msb)		G		AL2
SHIFT			K
TOP			L
CTRL	 		M
META	 		N
STROBE			b

note 2:	 The BURNDY loc refers to the pin on the 38 pin Burndy
	 connectors currently in use (5-Jun-79).  Their function will
	 be replaced by the serializer, and thus they will be replaced.
	 This info is really only for hooking up the prototype.

note 3:	 The Prototype loc refers to the location on the DEC-style
	 wire-wrap panel on which the prototype serializer is
	 built.  It will be flushed even sooner than the BURNDY
	 connectors (I hope).

note 4:	 Notice that I really mean lower-case "b" for STROBE on the
	 BURNDY connector.

note 6:	 Throughout this documentation, the data bits are numbered B0
	 to B5 (B0 is the least-signigicant bit).  The Micro Switch
	 documentation numbers them B1 through B6.  Beware when looking
	 at the Micro Switch documentation.